class Dog(object):
    def __init__(self, name):
        self.name = name

    def play(self):
        print('%s在快乐的玩耍' % self.name)


class XtDog(Dog):
    def play(self):  # 重写
        print('%s在天上快乐的玩耍' % self.name)


class Preson(object):
    def __init__(self, name):
        self.name = name

    def pre_play_dog(self, dog):
        print('%s和%s玩的很开心' % (self.name, dog.name))
        dog.play()


wangcai = Dog('旺财')
# wangcai = XtDog('飞天旺财')
xiaoming = Preson('小明')
xiaoming.pre_play_dog(wangcai)
